package com.example.venadaoa.activity.workflowmenu;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;

import com.example.venadaoa.R;
import com.example.venadaoa.activity.setting.NoticeListActivity;
import com.example.venadaoa.base.BaseActivity;
import com.example.venadaoa.datamanager.MenuManage;
import com.example.venadaoa.datamanager.UserInfo;
import com.example.venadaoa.tool.ToastHelp;
import com.example.venadaoa.tool.ViewUtils;

public class NoticeManageMenuActivity extends BaseActivity {
	private NoticeManageMenuActivity noticeManageMenuActivity;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.other_menu_view);
		mPageName = "NoticeManageMenuActivity";
		noticeManageMenuActivity = this;

		ListView listView = (ListView) findViewById(R.id.list);

		TextView title = (TextView)findViewById(R.id.title_content);
		title.setText(this.getString(R.string.notice));
		findViewById(R.id.title_bar_btn_left).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {

				finish();
			}
		});

		ViewUtils view1 = new ViewUtils(this, R.layout.other_view_item);

		view1.setList(MenuManage.getInstence().getMainMenu(this, MenuManage.getInstence().menu9Id));
		listView.setAdapter(view1);
		
		listView.setOnItemClickListener(new OnItemClickListener(){  
			  
			   @Override  
			   public void onItemClick(AdapterView<?> parent, View view,  
			     int position, long id) {  
			    switch (position) {
				case 0:
					if(UserInfo.ishaveCode(context))
					{
						Intent intent = new Intent(noticeManageMenuActivity, NoticeListActivity.class);
						intent.putExtra("TYPE_NOTICE", "all");
						startActivity(intent);	
					}else
					{
						ToastHelp.doToastInTop(noticeManageMenuActivity, "没有权限");
					}
					
					break;
					
				case 1:	
				{
					Intent intent1 = new Intent(noticeManageMenuActivity, NoticeListActivity.class);
					intent1.putExtra("TYPE_NOTICE", "notRead");
					startActivity(intent1);				
					}
					
					break;
					
				case 2:
					Intent intent2 = new Intent(noticeManageMenuActivity, NoticeListActivity.class);
					intent2.putExtra("TYPE_NOTICE", "my");
					startActivity(intent2);
					break;

				default:
					break;
				}  
			   }  
			        });
		
		
	}


}